home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1990 February / 1990-02.d64 / sound sampler (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  129 lines

  1. 10 rem copyright 1990 compute! publications, inc. - all rights reserved
  2. 20 print"[147]"tab(12)"copyright 1990":printtab(6)"compute! publications, inc."
  3. 30 printtab(10)"all rights reserved"
  4. 40 forjf=1to2500:next
  5. 50 data 4,14,24,34
  6. 60 data 3,5,7,9,11,13,15,17,19,21
  7. 70 for q=1to4:readx:cr(q)=x:next
  8. 80 for q=1to10:readx:lr(q)=x:next
  9. 90 dimz(4,10)
  10. 100 poke53281,0:poke53280,14
  11. 110 print"[147]           sound sampler 64"
  12. 120 print:print"voice #1  [150]voice #2  [129]voice #3  [159]all 3"
  13. 130 print"[158]"
  14. 140 datafrhi,frlo,pulo,puhi,wvfm,atak,dcay,sust,rels,play
  15. 150 forq=1to10:readx$:forq2=1to3:printx$;"      ";:nextq2:print:print:nextq
  16. 160 dataclr ,vol ,filo,fihi,reso,fivo,fity,play
  17. 170 forq=1to8:poke214,lr(q):print:poke211,cr(4):readx$:print"[157][157][157][157]"x$:nextq
  18. 180 print"[155]"
  19. 190 s=54272:forq=0to24:pokes+q,0:nextq:forq=1to4:forq2=1to10:z(q,q2)=0
  20. 200 next:next
  21. 210 forc=1to3:forl=1to10:poke214,lr(l):print:poke211,cr(c):printz(c,l);"[157]   "
  22. 220 next:next
  23. 230 forq=1to8:poke214,lr(q):print:poke211,cr(4):print0;"[157]   ":next
  24. 240 print:print"press f1 to print";
  25. 250 c=1:l=1
  26. 260 rem   ** movement loop **
  27. 270 poke214,lr(l):print:poke211,cr(c):print""z(c,l)"[157] [146]";:poke211,cr(c)
  28. 280 js=peek(56320)
  29. 290 geta$:ifa$=chr$(133)then1030:rem print
  30. 300 ifjs=127then280
  31. 310 ifjs=111thenpoke53280,7:forjs=0to199:next:goto450
  32. 320 print"[146]"z(c,l);"[157]  "
  33. 330 ifjs=126thenl=l-1:rem up
  34. 340 ifjs=125thenl=l+1:rem down
  35. 350 ifjs=123thenc=c-1:rem left
  36. 360 ifjs=119thenc=c+1:rem right
  37. 370 ifl>10thenl=10
  38. 380 ifl<1thenl=1
  39. 390 if(c=4)and(l>8)thenl=8
  40. 400 ifc<1thenc=1
  41. 410 ifc>4thenc=4
  42. 420 if(l>8)and(c>3)thenc=3
  43. 430 goto270
  44. 440 rem   **    change loop    **
  45. 450 ifc=4then870
  46. 460 ifl=1thenm=s+1:f=0:t=255:goto560
  47. 470 ifl=2thenm=s:f=0:t=255:goto560
  48. 480 ifl=3thenm=s+2:f=0:t=255:goto560
  49. 490 ifl=4thenm=s+3:f=0:t=15:goto560
  50. 500 ifl=5then680
  51. 510 ifl=6thenm=s+5:f=2:p=z(c,7):t=15:goto560
  52. 520 ifl=7thenm=s+5:f=1:p=z(c,6):t=15:goto560
  53. 530 ifl=8thenm=s+6:f=2:p=z(c,9):t=15:goto560
  54. 540 ifl=9thenm=s+6:f=1:p=z(c,8):t=15:goto560
  55. 550 ifl=10then820
  56. 560 js=peek(56320)
  57. 570 ifjs=127then560
  58. 580 ifjs=125thenz(c,l)=z(c,l)-1:goto620
  59. 590 ifjs=126thenz(c,l)=z(c,l)+1:goto620
  60. 600 ifjs=111thenpoke53280,14:forjs=0to199:next:goto260
  61. 610 goto560
  62. 620 ifz(c,l)>tthenz(c,l)=0:poke211,cr(c):print"     ";:goto640
  63. 630 ifz(c,l)<0thenz(c,l)=t:goto640
  64. 640 iff=0thenpokem+(c-1)*7,z(c,l):goto670
  65. 650 iff=1thenpokem+(c-1)*7,p+z(c,l):goto670
  66. 660 iff=2thenpokem+(c-1)*7,p+z(c,l)*16
  67. 670 poke211,cr(c):print"";z(c,l);"[157] [146] ";:goto560
  68. 680 rem ** waveform change **
  69. 690 js=peek(56320)
  70. 700 ifjs=127then690
  71. 710 ifjs=125then750
  72. 720 ifjs=126then780
  73. 730 ifjs=111thenpoke53280,14:forjs=0to199:next:goto270
  74. 740 goto690
  75. 750 ifz(c,l)=0thenz(c,l)=128:goto770
  76. 760 z(c,l)=z(c,l)/2:ifz(c,l)<16thenz(c,l)=0
  77. 770 pokes+4+(c-1)*7,z(c,l):poke211,cr(c):print"";z(c,l);"[157] [146] ";:goto680
  78. 780 ifz(c,l)=0thenz(c,l)=16:goto810
  79. 790 z(c,l)=z(c,l)*2
  80. 800 ifz(c,l)>128thenz(c,l)=0:poke211,cr(c):print"";z(c,l);"[157] [146]  ";
  81. 810 pokes+4+(c-1)*7,z(c,l):poke211,cr(c):print"";z(c,l);"[157] [146] ";:goto680
  82. 820 poke53280,14:rem play a voice
  83. 830 ifz(c,l)=0thenpokes+4+(c-1)*7,z(c,5)+1:goto860
  84. 840 pokes+4+(c-1)*7,z(c,5):z(c,l)=0:poke211,cr(c):print"";z(c,l);"[157] [146]";
  85. 850 goto260
  86. 860 z(c,l)=1:poke211,cr(c):print"";z(c,l);"[157] [146]";:goto260
  87. 870 rem   ** all voices column **
  88. 880 ifl=1thenpoke53280,14:goto190
  89. 890 ifl=2thenm=s+3:f=1:p=z(c,7):t=15:goto560
  90. 900 ifl=3thenm=s:f=0:t=7:goto560
  91. 910 ifl=4thenm=s+1:f=0:t=255:goto560
  92. 920 ifl=5thenm=s+2:f=2:p=z(c,6):t=15:goto560
  93. 930 ifl=6thenm=s+2:f=1:p=z(c,5):t=7:goto560
  94. 940 ifl=7then1190:rem else play all voices
  95. 950 poke214,lr(10):print:forg=0to2:pokes+4+g*7,z(g+1,5):poke211,cr(g+1)
  96. 960 print0"[157] ";:z(g+1,10)=0:next
  97. 970 ifz(c,l)=1thenz(c,l)=0:poke214,lr(8):print:goto990
  98. 980 goto1000
  99. 990 poke211,cr(c):print"";z(c,l);"[157] [146] ";:poke53280,14:goto260
  100. 1000 poke214,lr(10):print:forg=0to2:pokes+4+g*7,z(g+1,5)+1:poke211,cr(g+1)
  101. 1010 print1;"[157] ";:z(g+1,10)=1:next
  102. 1020 poke214,lr(8):print:z(c,l)=1:goto990
  103. 1030 rem print it
  104. 1040 print"[147]":input"enter title:";y$(0):print
  105. 1050 input"enter name of voice 1:";y$(1)
  106. 1060 print:input"enter name of voice 2:";y$(2)
  107. 1070 print:input"enter name of voice 3:";y$(3)
  108. 1080 print:print"printing..."
  109. 1090 open4,4:print#4,"sound sample: ";y$(0):print#4,""
  110. 1100 print#4,"s=54272. reg's given in 's+' notation:"
  111. 1110 forn=1to3:print#4,y$(n):forn2=0to4:print#4,(n-1)*7+n2;": ";z(n,n2+1)
  112. 1120 nextn2:print#4,5+(n-1)*7;": ";z(n,6)*256+z(n,7)
  113. 1130 print#4,6+(n-1)*7;": ";z(n,8)*256+z(n,9):nextn
  114. 1140 print#4,"":print#4,21;": ";z(4,3)
  115. 1150 print#4,22;": ";z(4,4)
  116. 1160 print#4,23;": ";z(4,5)+z(4,6)
  117. 1170 print#4,24;": ";z(4,2)+z(4,7)*16
  118. 1180 close4:print"done!":end
  119. 1190 rem adjust filter type
  120. 1200 js=peek(56320):ifjs=127then1200
  121. 1210 ifjs=111thenpoke53280,14:forjs=0to199:next:goto270
  122. 1220 ifjs=125thenz(c,l)=z(c,l)-1:goto1250
  123. 1230 ifjs=126thenz(c,l)=z(c,l)+1:goto1250
  124. 1240 goto1200
  125. 1250 ifz(c,l)>7thenz(c,l)=0
  126. 1260 ifz(c,l)<0thenz(c,l)=7
  127. 1270 pokes+24,z(c,2)+z(c,l)*16:poke211,cr(c):print"";z(c,l);"[157] [146] ";
  128. 1280 goto1200
  129.